package 力扣;

public class 挑选合适的数 {
    public static void main(String[] args){
        int a[] = {1,2,2,3};
        System.out.println(function1(a,3));
    }
    public static int function1(int[] nums, Integer limit){
        int a=0;
        for(int i=0 ;i<nums.length;){
            try {
                a=a+1;
                i=i+2;
            }catch (Exception e){
                a=a+1;i++;
            }

        }
        return a;
    }
}
